package com.tbit.uqbike.compalint.service.factory;

import com.tbit.uqbike.compalint.enums.PlatformEnum;
import com.tbit.uqbike.compalint.service.base.AbstractComplaintService;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 客诉api 工厂
 * 工厂模式+策略模式
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2025/2/14
 */
@AllArgsConstructor
@Component
public class ComplaintFactory {

    private final Map<String, AbstractComplaintService> map;

    /**
     * 根据具体平台获取具体客诉实现类
     * @param platform 平台枚举
     * @return 具体平台客诉api实现类
     */
    public AbstractComplaintService getComplaintService(PlatformEnum platform){
        return map.get(platform.getClassName());
    }

}
